﻿''============================================================================
''OMANE - Outils de calcul actuariat emprunteur
''Copyright © 2009 PIERRE TISSOT CONSEIL / NATIXIS ASSURANCES
''=============================================================================
Imports PTIC_Util
Imports System.Collections.ObjectModel


''' <summary>
''' Dictionnaire de parametres indexés par leur noms
''' </summary>
''' <remarks></remarks>
<Serializable()> Public Class ParametresList
    Inherits Dictionary(Of String, IParametre)

#Region "Variables privées"
    <NonSerialized()> Private m_ListeTablesReferentiel As ReadOnlyCollection(Of IInfoTableReferentiel)
    <NonSerialized()> Private _coll_parametres_decl As Hashtable
    <NonSerialized()> Private _coll_parametres_uniq As Hashtable
#End Region

#Region "Constructeur, initialisations"

    ''' <summary>
    ''' Constructeur d'une collection vide
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New(ByVal ListeTableReferentiel As ReadOnlyCollection(Of IInfoTableReferentiel))
        'Initialisation de la table de hachage
        MyBase.New()
        m_ListeTablesReferentiel = ListeTableReferentiel
        init()
        Me._coll_parametres_decl = New Hashtable
        Me._coll_parametres_uniq = New Hashtable
    End Sub

    ''' <summary>
    ''' Initialisation de tous les paramètres
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub init()
        initTaxeAssu()
        initTx_TechA()
        initTx_RembAntiA()
        initTx_RendActifsA()
        initTx_TaxeImpoA()
        initTx_RendActionnairesA()
        initCoutEmprSubA()
        initTx_fraiGestA()
        initTx_CommiContA()
        initTx_CouvEmprSuboA()
        initTx_FondPropSurMSR()
        initTable_Mortalite_F()
        initAge_FinDC()
        initPres_GarantiePTIA()
        initTx_PrixGarantiePTIA()
        initTx_Majo_sinDCPTIA()
        initSel_medic()
        iniTble_maintien_incinv()
        initAge_FinINCINV()
        initFranchise_INCAP()
        initTx_abat_MalaNonObje()
        initTx_abat_ExclPerteRev()
        initTx_MajoPrudSinINCINV()
        initTx_chgtSecuINCINV()
        initTx_mensEntreeINCINV()
        initDuree_Actu()
        initTxNom_Actu()
        initTxMort_Actu()
        initTable_Mortalite_H()
        initTble_maintien_incinvFRA()
        initGrilleTarifaire()
        initTbleMaintienINCINV_Methode2()
    End Sub

    ''' <summary>
    ''' Réinitialisation des valeurs des paramètres
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub Reset()
        resetTaxeAssu()
        resetTx_TechA()
        resetTx_RembAntiA()
        resetTx_RendActifsA()
        resetTx_TaxeImpoA()
        resetTx_RendActionnairesA()
        resetCoutEmprSubA()
        resetTx_fraiGestA()
        resetTx_CommiContA()
        resetTx_CouvEmprSuboA()
        resetTx_FondPropSurMSR()
        resetTable_Mortalite_F()
        resetAge_FinDC()
        resetPres_GarantiePTIA()
        resetTx_PrixGarantiePTIA()
        resetTx_Majo_sinDCPTIA()
        resetSel_medic()
        resetTble_Maintien_incinv()
        resetAge_FinINCINV()
        resetFranchise_INCAP()
        resetTx_abat_MalaNonObje()
        resetTx_abat_ExclPerteRev()
        resetTx_MajoPrudSinINCINV()
        resetTx_chgtSecuINCINV()
        resetTx_mensEntreeINCINV()
        resetDuree_Actu()
        resetTxNom_Actu()
        resetTxMort_Actu()
        resetTable_Mortalite_H()
        resetTble_maintien_incinvFRA()
        resetGrilleTarifaire()
        resetTbleMaintienINCINV_Methode2()
    End Sub

#Region "Crétion des paramètres OMANE"
    ''' <summary>
    ''' 0 - La taxe d'assurance
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTaxeAssu()
        Dim paramTx_TaxeAss As New GeneriqueTypedParametre_Double(csteParam.nomTx_TaxeAssu, _
                                                                  csteParam.descTx_TaxeAssu, _
                                                                  New Boolean() {True, True}, 0.09)
        Add(csteParam.nomTx_TaxeAssu, paramTx_TaxeAss)
    End Sub
    Protected Sub resetTaxeAssu()
        Tx_TaxeAssu.ValeurUnique = 0.09
    End Sub

    ''' <summary>
    ''' 1 - Le taux technique annuel
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_TechA()
        Dim paramTx_TechA As New GeneriqueTypedParametre_Double(nomTx_TechA, _
                                                                descTx_TechA, _
                                                                New Boolean() {True, True}, 0.0175)
        Add(nomTx_TechA, paramTx_TechA)
    End Sub
    Protected Sub resetTx_TechA()
        Tx_TechA.ValeurUnique = 0.0175
    End Sub

    ''' <summary>
    ''' 2 - Le taux de remboursement anticipés
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_RembAntiA()
        Dim paramTx_RembAntiA As New GeneriqueTypedParametre_Double(csteParam.nomTx_RembAntiA, _
                                                                    csteParam.descTx_RembAntiA, _
                                                                    New Boolean() {False, True}, 0.05)
        Add(csteParam.nomTx_RembAntiA, paramTx_RembAntiA)
    End Sub
    Protected Sub resetTx_RembAntiA()
        Tx_RembAntiA.ValeurUnique = 0.05
    End Sub

    ''' <summary>
    ''' 3 - Le taux de rendement attendu des actifs
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_RendActifsA()
        Dim paramTx_RendActifsA As New GeneriqueTypedParametre_Double(csteParam.nomTx_RendActifsA, _
                                                                      csteParam.descTx_RendActifsA, _
                                                                      New Boolean() {False, True}, 0.04)
        Add(csteParam.nomTx_RendActifsA, paramTx_RendActifsA)
    End Sub
    Protected Sub resetTx_RendActifsA()
        Tx_RendActifsA.ValeurUnique = 0.04
    End Sub

    ''' <summary>
    ''' 4 - L'impôt sur les sociétés
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_TaxeImpoA()
        Dim paramTx_TaxeImpoA As New GeneriqueTypedParametre_Double(csteParam.nomTx_TaxeImpoA, _
                                                                    csteParam.descTx_TaxeImpoA, _
                                                                    New Boolean() {False, True}, 1 / 3)
        Add(csteParam.nomTx_TaxeImpoA, paramTx_TaxeImpoA)
    End Sub
    Protected Sub resetTx_TaxeImpoA()
        Tx_TaxeImpoA.ValeurUnique = 1 / 3
    End Sub

    ''' <summary>
    ''' 5 - Le taux de rendement annuel exigé par les actionnaires
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_RendActionnairesA()
        Dim paramTx_RendActionnairesA As New GeneriqueTypedParametre_Double(csteParam.nomTx_RendActionnairesA, _
                                                                            csteParam.descTx_RendActionnairesA, _
                                                                            New Boolean() {False, True}, 0.1)
        Add(csteParam.nomTx_RendActionnairesA, paramTx_RendActionnairesA)
    End Sub
    Protected Sub resetTx_RendActionnairesA()
        Tx_RendActionnairesA.ValeurUnique = 0.1
    End Sub

    ''' <summary>
    ''' 6 - Le coût annuel des emprunts subordonnés 
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initCoutEmprSubA()
        '6 - Le coût annuel des emprunts subordonnés
        Dim paramTx_CoutEmprSuboA As New GeneriqueTypedParametre_Double(csteParam.nomTx_CoutEmprSuboA, _
                                                                        csteParam.descTx_CoutEmprSuboA, _
                                                                        New Boolean() {False, True}, 0.0024)
        Add(csteParam.nomTx_CoutEmprSuboA, paramTx_CoutEmprSuboA)
    End Sub
    Protected Sub resetCoutEmprSubA()
        Tx_CoutEmprSuboA.ValeurUnique = 0.0024
    End Sub

    ''' <summary>
    ''' 7 - Les frais de gestion annuels
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_fraiGestA()
        Dim paramTx_fraiGestA As New GeneriqueTypedParametre_Double(nomTx_fraiGestA, _
                                                                    descTx_fraiGestA, _
                                                                    New Boolean() {True, True}, 0.07)
        Add(nomTx_fraiGestA, paramTx_fraiGestA)
    End Sub
    Protected Sub resetTx_fraiGestA()
        Tx_fraiGestA.ValeurUnique = 0.07
    End Sub

    ''' <summary>
    ''' 8 - La commission contractante
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_CommiContA()
        Dim paramTx_CommiContA As New GeneriqueTypedParametre_Double(nomTx_CommiContA, _
                                                                     descTx_CommiContA, _
                                                                     New Boolean() {True, True}, 0.42)
        Add(nomTx_CommiContA, paramTx_CommiContA)
    End Sub
    Protected Sub resetTx_CommiContA()
        Tx_CommiContA.ValeurUnique = 0.42
    End Sub

    ''' <summary>
    ''' 9 - Le taux de couverture des emprunts subordonnés
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_CouvEmprSuboA()
        Dim paramTx_CouvEmprSuboA As New GeneriqueTypedParametre_Double(csteParam.nomTx_CouvEmprSuboA, _
                                                                        csteParam.descTx_CouvEmprSuboA, _
                                                                        New Boolean() {False, True}, 0.25)
        Add(csteParam.nomTx_CouvEmprSuboA, paramTx_CouvEmprSuboA)
    End Sub
    Protected Sub resetTx_CouvEmprSuboA()
        Tx_CouvEmprSuboA.ValeurUnique = 0.25
    End Sub

    ''' <summary>
    ''' 10 - Le ratio fonds propres alloués / MSR
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_FondPropSurMSR()
        Dim paramTx_FondPropSurMSR As New GeneriqueTypedParametre_Double(csteParam.nomTx_FondPropSurMSR, _
                                                                         csteParam.descTx_FondPropSurMSR, _
                                                                         New Boolean() {False, True}, 1.14)
        Add(csteParam.nomTx_FondPropSurMSR, paramTx_FondPropSurMSR)
    End Sub
    Protected Sub resetTx_FondPropSurMSR()
        Tx_FondPropSurMSR.ValeurUnique = 1.14
    End Sub

    ''' <summary>
    ''' 11 - Table de mortalité des femmes
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTable_Mortalite_F()

        'Récupérer le premier nom de table disponible dans le référentiel
        'Dim NomTableMortF As String =
        '    (From elt As IInfoTableReferentiel In m_ListeTablesReferentiel
        '    Where elt.TypeTable = "DC"
        '    Select elt).AsEnumerable.FirstOrDefault.NomFichier

        Dim paramTable_Mortalite_F As New GeneriqueTypedParametre_String( _
            csteParam.nomTable_Mortalite_F, _
            csteParam.descTable_Mortalite_F, _
            New Boolean() {True, True},
            "Table_DC_Empr_F.sas7bdat")

        Add(csteParam.nomTable_Mortalite_F, paramTable_Mortalite_F)

    End Sub
    Protected Sub resetTable_Mortalite_F()

        'Dim NomTableMortF As String =
        '   (From elt As IInfoTableReferentiel In m_ListeTablesReferentiel
        '   Where elt.TypeTable = "DC"
        '   Select elt).AsEnumerable.FirstOrDefault.NomTable

        Table_Mortalite_F.ValeurUnique = "Table_DC_Empr_F.sas7bdat"

    End Sub

    ''' <summary>
    ''' 12 - Age de fin de la garantie décès (en années)
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initAge_FinDC()
        Dim paramAge_FinDC As New GeneriqueTypedParametre_Double(csteParam.nomAge_FinDC, _
                                                                 csteParam.descAge_FinDC, _
                                                                 New Boolean() {True, True}, 70)
        Add(csteParam.nomAge_FinDC, paramAge_FinDC)
    End Sub
    Protected Sub resetAge_FinDC()
        Age_FinDC.ValeurUnique = 70
    End Sub

    ''' <summary>
    ''' 13 - Présence de la garantie PTIA
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initPres_GarantiePTIA()
        Dim paramPres_GarantiePTIA As New GeneriqueTypedParametre_Boolean(csteParam.nomPres_GarantiePTIA, _
                                                                          csteParam.descPres_GarantiePTIA, _
                                                                          New Boolean() {True, True}, True)
        Add(csteParam.nomPres_GarantiePTIA, paramPres_GarantiePTIA)
    End Sub
    Protected Sub resetPres_GarantiePTIA()
        Pres_GarantiePTIA.ValeurUnique = True
    End Sub


    ''' <summary>
    ''' 14 - Tarif de la garantie PTIA
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_PrixGarantiePTIA()
        Dim paramTx_PrixGarantiePTIA As New GeneriqueTypedParametre_Double(csteParam.nomTx_PrixGarantiePTIA, _
                                                                csteParam.descTx_PrixGarantiePTIA, _
                                                                New Boolean() {True, True}, 0.03)
        Add(csteParam.nomTx_PrixGarantiePTIA, paramTx_PrixGarantiePTIA)
    End Sub
    Protected Sub resetTx_PrixGarantiePTIA()
        Tx_PrixGarantiePTIA.ValeurUnique = 0.03
    End Sub

    ''' <summary>
    ''' 15 - Majoration prudentielle des montants de sinistres DC/PTIA
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_Majo_sinDCPTIA()
        Dim paramTx_Majo_sinDCPTIA As New GeneriqueTypedParametre_Double(csteParam.nomTx_Majo_sinDCPTIA, _
                                                                csteParam.descTx_Majo_sinDCPTIA, _
                                                                New Boolean() {True, True}, 0.12)
        Add(csteParam.nomTx_Majo_sinDCPTIA, paramTx_Majo_sinDCPTIA)
    End Sub
    Protected Sub resetTx_Majo_sinDCPTIA()
        Tx_Majo_sinDCPTIA.ValeurUnique = 0.12
    End Sub

    ''' <summary>
    ''' 16 - Sélection médicale
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initSel_medic()
        Dim paramSelMedicale As New ParametreSelectionMedicale(nomSel_medic, _
                                                               "Sélection médicale", _
                                                               New Boolean() {False, True})
        Add(csteParam.nomSel_medic, paramSelMedicale)
    End Sub
    Protected Sub resetSel_medic()
        Sel_medic.Reset()
    End Sub

    ''' <summary>
    ''' 17 - Table de maintien en incapacité/invalidité
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub iniTble_maintien_incinv()
        Dim paramTble_maintien_incinv As New GeneriqueTypedParametre_String(csteParam.nomTble_maintien_incinv, _
                                                                            csteParam.descTble_maintien_incinv, _
                                                                            New Boolean() {True, False}, _
                                                                            "TbleINCINVTaux.sas7bdat")
        Add(csteParam.nomTble_maintien_incinv, paramTble_maintien_incinv)
    End Sub
    Protected Sub resetTble_Maintien_incinv()
        Tble_maintien_incinv.ValeurUnique = "TbleINCINVTaux.sas7bdat"
    End Sub

    ''' <summary>
    ''' 18 - Age de fin des garanties INCAP / INVAL
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initAge_FinINCINV()
        Dim paramAge_FinINCINV As New GeneriqueTypedParametre_Double(csteParam.nomAge_FinINCINV, _
                                                                csteParam.descAge_FinINCINV, _
                                                                New Boolean() {True, True}, 65)
        Add(csteParam.nomAge_FinINCINV, paramAge_FinINCINV)
    End Sub
    Protected Sub resetAge_FinINCINV()
        Age_FinINCINV.ValeurUnique = 65
    End Sub

    ''' <summary>
    ''' 19 - Franchise INCAP (en nombre de jours)
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initFranchise_INCAP()
        Dim paramfranchise_INCAP As New GeneriqueTypedParametre_Double(csteParam.nomfranchise_INCAP, _
                                                        csteParam.descfranchise_INCAP, _
                                                        New Boolean() {False, True}, 3)
        Add(csteParam.nomfranchise_INCAP, paramfranchise_INCAP)
    End Sub
    Protected Sub resetFranchise_INCAP()
        franchise_INCAP.ValeurUnique = 3
    End Sub

    ''' <summary>
    ''' 20 - Abattement exclusion Maladies Non Objectivables
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_abat_MalaNonObje()
        Dim paramTx_abat_MalaNonObje As New GeneriqueTypedParametre_Double(csteParam.nomTx_abat_MalaNonObje, _
                                                        csteParam.descTx_abat_MalaNonObje, _
                                                        New Boolean() {True, True}, 0.2)
        Add(csteParam.nomTx_abat_MalaNonObje, paramTx_abat_MalaNonObje)
    End Sub
    Protected Sub resetTx_abat_MalaNonObje()
        Tx_abat_MalaNonObje.ValeurUnique = 0.2
    End Sub

    ''' <summary>
    ''' 21 - Abattement exclusion Perte de revenus
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_abat_ExclPerteRev()
        Dim paramTx_abat_ExclPerteRev As New GeneriqueTypedParametre_Double(csteParam.nomTx_abat_ExclPerteRev, _
                                                        csteParam.descTx_abat_ExclPerteRev, _
                                                        New Boolean() {True, True}, 0.3)
        Add(csteParam.nomTx_abat_ExclPerteRev, paramTx_abat_ExclPerteRev)
    End Sub
    Protected Sub resetTx_abat_ExclPerteRev()
        Tx_abat_ExclPerteRev.ValeurUnique = 0.3
    End Sub

    ''' <summary>
    ''' 22 - Majoration prudentielle des montants de sinistre incapacité / invalidité
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_MajoPrudSinINCINV()
        Dim paramTx_MajoPrudSinINCINV As New GeneriqueTypedParametre_Double(csteParam.nomTx_MajoPrudSinINCINV, _
                                                        csteParam.descTx_MajoPrudSinINCINV, _
                                                        New Boolean() {False, True}, 0.045)
        Add(csteParam.nomTx_MajoPrudSinINCINV, paramTx_MajoPrudSinINCINV)
    End Sub
    Protected Sub resetTx_MajoPrudSinINCINV()
        Tx_MajoPrudSinINCINV.ValeurUnique = 0.045
    End Sub

    ''' <summary>
    ''' 23 - Chargement de sécurité lié aux incertitudes sur la table INCAP / INVAL
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_chgtSecuINCINV()
        Dim paramTx_chgtSecuINCINV As New GeneriqueTypedParametre_Double(csteParam.nomTx_chgtSecuINCINV, _
                                                        csteParam.descTx_chgtSecuINCINV, _
                                                        New Boolean() {True, True}, 0.15)
        Add(csteParam.nomTx_chgtSecuINCINV, paramTx_chgtSecuINCINV)
    End Sub
    Protected Sub resetTx_chgtSecuINCINV()
        Tx_chgtSecuINCINV.ValeurUnique = 0.15
    End Sub

    ''' <summary>
    ''' 24 - Taux mensuel d'entrée en incapacité / invalidité à 0 jours
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTx_mensEntreeINCINV()
        Dim paramTx_mensEntreeINCINV As New GeneriqueTypedParametre_Double(csteParam.nomTx_mensEntreeINCINV, _
            csteParam.descTx_mensEntreeINCINV, New Boolean() {True, True}, 0.005)
        Add(csteParam.nomTx_mensEntreeINCINV, paramTx_mensEntreeINCINV)
    End Sub
    Protected Sub resetTx_mensEntreeINCINV()
        Tx_mensEntreeINCINV.ValeurUnique = 0.005
    End Sub

    ''' <summary>
    ''' 25 - La durée actuarielle
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initDuree_Actu()
        Dim paramDuree_Actu As New GeneriqueTypedParametre_Double(nomDuree_Actu, _
                                                descDuree_Actu, _
                                                New Boolean() {True, True}, 180)
        Add(nomDuree_Actu, paramDuree_Actu)
    End Sub
    Protected Sub resetDuree_Actu()
        Duree_Actu.ValeurUnique = 180
    End Sub

    ''' <summary>
    ''' 26 - Le taux nominal actuariel
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTxNom_Actu()
        Dim paramTxNom_Actu As New GeneriqueTypedParametre_Double(nomTxNom_Actu, _
                                                descTxNom_Actu, _
                                                New Boolean() {True, True}, 0.004)
        Add(nomTxNom_Actu, paramTxNom_Actu)
    End Sub
    Protected Sub resetTxNom_Actu()
        TxNom_Actu.ValeurUnique = 0.005
    End Sub

    ''' <summary>
    ''' 27 - Les taux de mortalité actuariels
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTxMort_Actu()
        Dim paramTxMort_Actu As New GeneriqueTypedParametre_Double(nomTxMort_Actu, _
                                                descTxMort_Actu, _
                                                New Boolean() {True, True}, 0.0018)
        Add(nomTxMort_Actu, paramTxMort_Actu)
    End Sub
    Protected Sub resetTxMort_Actu()
        TxMort_Actu.ValeurUnique = 0.0005
    End Sub

    ''' <summary>
    ''' Table de mortalité retenue pour les Hommes
    ''' </summary>
    ''' <remarks></remarks>
    Protected Sub initTable_Mortalite_H()

        Dim paramTable_Mortalite_H As New GeneriqueTypedParametre_String(csteParam.nomTable_Mortalite_H, _
                                                                         csteParam.descTable_Mortalite_H, _
                                                                         New Boolean() {True, True}, _
                                                                         "Table_DC_Empr_H.sas7bdat")
        Add(csteParam.nomTable_Mortalite_H, paramTable_Mortalite_H)
    End Sub
    Protected Sub resetTable_Mortalite_H()
        Table_Mortalite_H.ValeurUnique = "Table_DC_Empr_H.sas7bdat"
    End Sub

    ''' <summary>
    ''' 29 - Abattements sur les taux de maintien incapacité/invalidité liés à la franchise
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub initTble_maintien_incinvFRA()
        Dim paramTble_maintien_incinvFRA As GeneriqueTypedParametre(Of String) = _
                New GeneriqueTypedParametre_String(csteParam.nomtble_maintien_incinvFRA, _
                                                   csteParam.desctble_maintien_incinvFRA, _
                                                   New Boolean() {True, True}, "TbleINCINVFra.sas7bdat")
        Add(paramTble_maintien_incinvFRA.Nom, paramTble_maintien_incinvFRA)
    End Sub
    Public Sub resetTble_maintien_incinvFRA()
        tble_maintien_incinvFRA.ValeurUnique = "TbleINCINVFra.sas7bdat"
    End Sub

    ''' <summary>
    ''' 30 - Grille tarifaire
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub initGrilleTarifaire()
        Dim paramGrilleTarifaire As GeneriqueTypedParametre(Of String) = _
                New GeneriqueTypedParametre_String(csteParam.nomGrilleTarifaire, _
                                                   csteParam.descGrilleTarifaire, _
                                                   New Boolean() {True, True}, "tarifBPLC.sas7bdat")
        Add(paramGrilleTarifaire.Nom, paramGrilleTarifaire)
    End Sub
    Public Sub resetGrilleTarifaire()
        GrilleTarifaire.ValeurUnique = "tarifBPLC.sas7bdat"
    End Sub

    ''' <summary>
    ''' 31 - Maintien en INCAP/INVAL - modèle 2
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub initTbleMaintienINCINV_Methode2()
        Dim paramTble_maintien_incinvM2 As New GeneriqueTypedParametre_String(csteParam.nomTble_maintien_incinvM2, _
                                                                              csteParam.descTble_maintien_incinvM2, _
                                                                              New Boolean() {False, True}, _
                                                                              "MaintINCINV_CNP_MENS.sas7bdat")
        Add(csteParam.nomTble_maintien_incinvM2, paramTble_maintien_incinvM2)
    End Sub
    Public Sub resetTbleMaintienINCINV_Methode2()
        Tble_maintienINCINVM2.ValeurUnique = "MaintINCINV_CNP_MENS.sas7bdat"
    End Sub

#End Region

#End Region

#Region "Typage fort pour OMANE"
    ''' <summary>
    ''' Taux nominal actuariel (taux nominal moyen pondéré par les capitaux sous risque)
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property TxNom_Actu As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTxNom_Actu)
        End Get
    End Property

    ''' <summary>
    ''' Durée actuarielle (durée moyenne pondérée par les capitaux sous risque)
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Duree_Actu As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomDuree_Actu)
        End Get
    End Property

    ''' <summary>
    ''' Taxe d'assurance sur les risques non vie
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_TaxeAssu As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_TaxeAssu)
        End Get
    End Property

    ''' <summary>
    ''' Taux de mortalité actuariel (moyenne pondérée par les capitaux sous risque)
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property TxMort_Actu() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTxMort_Actu)
        End Get
    End Property

    ''' <summary>
    ''' Taux technique actuariel (moyenne pondérée par les capitaux sous risque)
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_TechA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_TechA)
        End Get
    End Property

    ''' <summary>
    ''' Taux annuel de remboursements anticipés
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_RembAntiA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_RembAntiA)
        End Get
    End Property

    ''' <summary>
    ''' Taux annuel de rendements des actifs
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_RendActifsA As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_RendActifsA)
        End Get
    End Property

    ''' <summary>
    ''' Taux d'imposition appliqué sur le résultat fiscal
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_TaxeImpoA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_TaxeImpoA)
        End Get
    End Property

    ''' <summary>
    ''' Taux de rendement escompté par les actionnaires
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_RendActionnairesA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_RendActionnairesA)
        End Get
    End Property

    ''' <summary>
    ''' Coût annuel des emprunts subordonnés
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_CoutEmprSuboA As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_CoutEmprSuboA)
        End Get
    End Property

    ''' <summary>
    ''' Taux annuel de frais de gestion
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_fraiGestA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_fraiGestA)
        End Get
    End Property

    ''' <summary>
    ''' Taux garanti
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_CommiContA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_CommiContA)
        End Get
    End Property

    ''' <summary>
    ''' Taux annuel de couverture par des emprunts subordonnés
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_CouvEmprSuboA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_CouvEmprSuboA)
        End Get
    End Property

    ''' <summary>
    ''' Ratio Fonds Propres / Marge de solvabilité règlementaire
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_FondPropSurMSR() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_FondPropSurMSR)
        End Get
    End Property

    ''' <summary>
    ''' Table de mortalité des femmes
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Table_Mortalite_F() As GeneriqueTypedParametre(Of String)
        Get
            Return Item(nomTable_Mortalite_F)
        End Get
    End Property

    ''' <summary>
    ''' Age de fin de la garantie décès
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Age_FinDC() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomAge_FinDC)
        End Get
    End Property

    ''' <summary>
    ''' Présence de la garantie PTIA
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Pres_GarantiePTIA() As GeneriqueTypedParametre(Of Boolean)
        Get
            Return Item(nomPres_GarantiePTIA)
        End Get
    End Property

    ''' <summary>
    ''' Prix de la garantie PTIA (en % du prix du décès)
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_PrixGarantiePTIA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_PrixGarantiePTIA)
        End Get
    End Property

    ''' <summary>
    ''' Taux de majoration prudentiel appliqué aux sinistres DC/PTIA
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_Majo_sinDCPTIA() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_Majo_sinDCPTIA)
        End Get
    End Property

    ''' <summary>
    ''' Sélection médicale
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Sel_medic() As ParametreSelectionMedicale
        Get
            Return Item(nomSel_medic)
        End Get
    End Property

    ''' <summary>
    ''' Table de maintien en INCAP/INVAL
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tble_maintien_incinv() As GeneriqueTypedParametre(Of String)
        Get
            Return Item(nomTble_maintien_incinv)
        End Get
    End Property

    ''' <summary>
    ''' Age de fin de la garantie INCAP/INVAL
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Age_FinINCINV() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomAge_FinINCINV)
        End Get
    End Property

    ''' <summary>
    ''' Nombre de jours de franchise sur la garantie INCAP
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property franchise_INCAP() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomfranchise_INCAP)
        End Get
    End Property

    ''' <summary>
    ''' Taux d'abattement de la sinistralité estimée en INCAP / INVAL lié aux maladies non objectivables
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_abat_MalaNonObje As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_abat_MalaNonObje)
        End Get
    End Property

    ''' <summary>
    ''' Taux d'abattement de la sinistralité estimée en INCAP / INVAL lié aux exclusion des pertes de revenus
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_abat_ExclPerteRev() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_abat_ExclPerteRev)
        End Get
    End Property

    ''' <summary>
    ''' Taux de majoration prudentiel appliqué à la sinistralité de la garantie INCAP / INVAL
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_MajoPrudSinINCINV() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_MajoPrudSinINCINV)
        End Get
    End Property

    ''' <summary>
    ''' Taux de chargement prudentiel appliqué sur la sinistralité INCAP / INVAL en raison des incertitudes sur la table de maintien
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_chgtSecuINCINV As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_chgtSecuINCINV)
        End Get
    End Property

    ''' <summary>
    ''' Taux mensuel d'entrée en INCAP / INVAL
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tx_mensEntreeINCINV() As GeneriqueTypedParametre(Of Double)
        Get
            Return Item(nomTx_mensEntreeINCINV)
        End Get
    End Property

    ''' <summary>
    ''' Table de mortalité des hommes
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Table_Mortalite_H() As GeneriqueTypedParametre(Of String)
        Get
            Return Item(nomTable_Mortalite_H)
        End Get
    End Property

    ''' <summary>
    ''' Table de maintien en INVCAP /INVAL (hors prise en compte de la franchise)
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property tble_maintien_incinvFRA() As GeneriqueTypedParametre(Of String)
        Get
            Return Item(nomtble_maintien_incinvFRA)
        End Get
    End Property

    ''' <summary>
    ''' Grille tarifaire
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property GrilleTarifaire() As GeneriqueTypedParametre(Of String)
        Get
            Return Item(nomGrilleTarifaire)
        End Get
    End Property

    ''' <summary>
    ''' Table de maintien en INCAP / INVAL du modèle 2
    ''' </summary>
    ''' <remarks></remarks>
    Public ReadOnly Property Tble_maintienINCINVM2() As GeneriqueTypedParametre(Of String)
        Get
            Return Item(nomTble_maintien_incinvM2)
        End Get
    End Property

#End Region

#Region "Collections de paramètres déclinés et uniques"

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="numMethode"></param>
    ''' <remarks></remarks>
    Public Sub MAJ_CollParamDeclUniq(ByVal numMethode As Integer)
        _coll_parametres_decl = New Hashtable
        _coll_parametres_uniq = New Hashtable
        For Each param As IParametre In Values
            If param.Nature = ParamNature.Declinee And param.Methode_Cal(numMethode - 1) Then
                _coll_parametres_decl.Add(param.Nom, param)
            ElseIf param.Methode_Cal(numMethode - 1) Then
                _coll_parametres_uniq.Add(param.Nom, param)
            End If
        Next
    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetParamDecl() As Hashtable
        Return _coll_parametres_decl
    End Function

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function getParamUniq() As Hashtable
        Return _coll_parametres_uniq
    End Function
#End Region

#Region "Gestion des relations de la base de données locale"

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub ParamRelationsV2(ByVal coll_Param As Hashtable,
                                ByVal tableTravail As DataTable,
                                ByVal DataSetRelations As DataSet)

        Dim i As Integer
        'Tableau des noms des variables de segmentation du paramètre
        Dim coll_varSegParam As List(Of String)
        'Tableau des colonnes de la table de travail appartenant à la relation
        Dim tabCol_ExtSeg() As DataColumn
        'Tableau des colonnes de la segmentation du paramètre appartenant à la relation
        Dim tabCol_ExtParam() As DataColumn
        'Intégration de la table de travail au dataSet

        Dim TableName As String = tableTravail.TableName
        If DataSetRelations.Tables.Contains(TableName) Then DataSetRelations.Tables.Remove(TableName)
        DataSetRelations.Tables.Add(tableTravail)

        For Each param As IParametre In coll_Param.Values
            'Récupération de la segmentation du paramètre
            coll_varSegParam = param.ListeSegments.ToList
            'Tableau des colonnes de la table de travail appartenant à la relation
            ReDim tabCol_ExtSeg(coll_varSegParam.Count - 1)
            'Tableau des colonnes de la segmentation du paramètre appartenant à la relation
            ReDim tabCol_ExtParam(coll_varSegParam.Count - 1)
            i = 0

            'Ajout dans le dataset de la table des valeurs du paramètre
            If DataSetRelations.Tables.Contains(param.Valeurs.TableName) Then DataSetRelations.Tables.Remove(param.Valeurs.TableName)
            DataSetRelations.Tables.Add(param.Valeurs)

            'Remplissage des tableaux de colonnes appartenant à la relation
            For Each col As DataColumn In DataSetRelations.Tables(TableName).Columns
                If param.Valeurs.Columns.Contains(col.ColumnName) And Not param.Nom = col.ColumnName Then
                    tabCol_ExtSeg(i) = col
                    tabCol_ExtParam(i) = param.Valeurs.Columns(col.ColumnName)
                    i = i + 1
                End If
            Next

            'For Each s As String In coll_varSegParam
            '    Dim nomSegment As String = Me.ListeTraitements.TraitEntreeModelesTxGar.ListeChampsSortie(s).chOutil.Nom
            '    tabCol_ExtSeg(i) = DataSetRelations.Tables("TableTravail").Columns(nomSegment)
            '    tabCol_ExtParam(i) = param.Valeurs.Columns(nomSegment)
            '    i = i + 1
            'Next

            'Ajout d'une colonne dans la table extraction destinée à accueillir les valeurs du paramètre 
            'si elle n'existe pas déjà
            If Not DataSetRelations.Tables(TableName).Columns.Contains(param.Nom) Then
                DataSetRelations.Tables(TableName).Columns.Add(param.Nom, param.Type)
            End If

            'Définition de la relation entre la table extraction et les valeurs du paramètre
            DataSetRelations.Relations.Add("relParam" & param.Nom, tabCol_ExtSeg, tabCol_ExtParam, False)

        Next

    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub SupprParamRelations(ByVal coll_Param As Hashtable, ByVal DataSetRelations As DataSet)
        For Each param As IParametre In coll_Param.Values
            DataSetRelations.Relations.Remove("relParam" & param.Nom)
        Next
        'If DataSetRelations.Tables.Contains("TableTravail") Then DataSetRelations.Tables.Remove("TableTravail")
    End Sub
#End Region

End Class
